package extracteur;


import java.util.Vector;

public class dataRecuit {


private Vector< Vector<Float> > d;
private Vector< Vector<Float> > c1;
private Vector< Vector<Float> > c2;
private Vector< Vector<Float> > c3;
private Vector< Vector<Float> > c4;
private Vector< Vector<Float> > c5; 
private Vector< Float> cout;
private double [][][][] matrice; //centrales, jours, paliers, scenarios
private double [][] matriceHydro; //centrales, jours, paliers, scenarios
private double [][] demande;
private int nb_centrale=4;
private int nb_jour=7;
private int nb_scenario=100;


public dataRecuit()
{
XLSExtracteur extractor = new XLSExtracteur();
Vector< Vector< Vector<Float> > > info = extractor.extraire_donnees_recuit();
d = info.get(0);
c1 = info.get(1);
c2 = info.get(2);
c3 = info.get(3);
c4 = info.get(4);
c5 = info.get(5);
this.cout = cout;
initialiser();
afficherHydro(5); 
}
public dataRecuit(Vector<Vector< Vector<Float> >> info) {
d = info.get(0);
c1 = info.get(1);
c2 = info.get(2);
c3 = info.get(3);
c4 = info.get(4);
c5 = info.get(5);
this.cout = cout;
initialiser();
}
public void initialiser()
{
this.matrice = new double[this.nb_centrale][][][];
initialiserMatrice(c1,0);
initialiserMatrice(c2,1);
initialiserMatrice(c3,2);
initialiserMatrice(c4,3);
initialiserDemande(d);
initialiserHydrolique(c5);
}
public double[][][][] getDataThermique()
{
return matrice;
}
public double[][] getDemande()
{
return demande;
}
private void initialiserDemande(Vector<Vector<Float>> d)
{
this.demande = new double[this.nb_jour][];
for(int i=0; i < nb_jour; i++)
{
this.demande[i] = new double[this.nb_scenario];
for(int j=0;j<this.nb_scenario;j++)
{
this.demande[i][j] = (double) d.get(j).get(i);
}
}
}
public void initialiserHydrolique(Vector<Vector<Float>> c)
{
this.matriceHydro = new double[nb_jour][];
int nb_paliers=c.get(0).size();
for(int i=0;i<nb_jour;i++)
{
this.matriceHydro[i] = new double[nb_paliers];
for(int j=0;j<nb_paliers;j++)
{
this.matriceHydro[i][j]=(double) c.get(i).get(j);
}
}
}
public void afficherHydro(int jour)
{
int nb_paliers = this.matriceHydro[jour].length;
System.out.println(nb_paliers);
for(int i=0; i < nb_paliers ; i++ )
{
System.out.println(String.valueOf(matriceHydro[jour][i]));
}
}
private void initialiserMatrice(Vector<Vector<Float>> c, int indice)
{
int nb_palier = (c.get(0).size())/nb_jour;
matrice[indice] = new double[nb_jour][][];
for(int i=0;i<nb_jour;i++)
{
matrice[indice][i]=new double[nb_palier][];
for(int k=0;k<nb_palier;k++)
{
matrice[indice][i][k] = new double[nb_scenario];
for(int j=0;j<nb_scenario;j++)
{
matrice[indice][i][k][j]=(double)c.get(j+1).get(nb_palier*i+k+1); 
}


}
}
}
public void afficher(int centrale, int temps, int palier)
{


for(int i=0;i<nb_scenario;i++)
System.out.println(String.valueOf(matrice[centrale][temps][palier][i]));


}
public void afficherDemande(int jour)
{
for(int i =0 ; i<nb_scenario;i++)
System.out.println(String.valueOf(this.demande[jour][i]));
}


public static void main(String[] args) {


dataRecuit d = new dataRecuit();
}
public double[][] getHydro() {
	// TODO Auto-generated method stub
	return matriceHydro;
}
}

